package service.sys;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.common.BaseMapper;
import com.common.BaseService;
import com.common.CommonUtil;

import beans.sys.UserBean;
import mapper.sys.UserMapper;

@Service
@Transactional
public class UserServiceImpl<T> extends BaseService<T>{

	@Autowired
	private UserMapper<T> userMapper;

	public List<UserBean> getAll(){
		List<UserBean> m = null;
		try {
			m = userMapper.selectAllUser();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return m;
	}

	@Override
	public BaseMapper<T> getMapper() {
		return userMapper;
	}

	public void deletes(String[] ids) {
		userMapper.batchDeletes(ids);
	}
	
	public void initPwd(String id,String pwd) {
		userMapper.initPwd(id,pwd);
	}
	
	public UserBean findByAccount(String id,String account){
		if(CommonUtil.isNullObject(id))
			return userMapper.findByAccount(account);
		else 
			return userMapper.findByAccountID(id,account);
	}

	public void UseStatus(String id, String type) {
		userMapper.UseStatus(id,type);
	}
}